package test5

import test4.Student
import test5.stu.Student1

object TestMatch3 {
  def main(args: Array[String]): Unit = {
    var s=null;
    var s1=Student("老吴",19);
    var s2=Student("Tom",22);
    var s3=Student("Laozhang",32);
    var s4=Student("laozhao");
    def matchStu(x:Student):Unit=
      x match {
        case Student(name,19)=>println(name)
        case Student("Tom", age)=>println(age)
        case Student(name,age)=>println(name+","+age)
        case _=>println("No matches")
      }
    matchStu(s)
    matchStu(s1)
    matchStu(s2)
    matchStu(s3)
    matchStu(s4)
  }
}
